#ifndef _QUICKLIB_MATH_H_
#define _QUICKLIB_MATH_H_

#include <cmath>

class Math
{

public:

    static const double PI;

    // min
    inline static int min(int a, int b);
    inline static int min(int a, int b, int c);
    inline static double min(double a, double b);
    inline static double min(double a, double b, double c);

    // max
    inline static int max(int a, int b);
    inline static int max(int a, int b, int c);
    inline static double max(double a, double b);
    inline static double max(double a, double b, double c);

    // round
    inline static int round(double a);
    inline static int floor(double a);
    inline static int ceil(double a);

    inline static double pow(double base, double exp);
    inline static double sqrt(double a);
    
    inline static double fabs(double a);
    inline static double log(double a);
    
    inline static double sin(double a);
    inline static double atan(double a);
    inline static double cos(double a);
    
};

inline int Math::min(int a, int b)
{
    if(a < b)
        return a;
    else
        return b;
}

inline int Math::min(int a, int b, int c)
{
    if(a < b)
        if(a < c)
            return a;
        else
            return c;
    else
        if(b < c)
            return b;
        else
            return c;
}

inline double Math::min(double a, double b)
{
    if(a < b)
        return a;
    else
        return b;
}

inline double Math::min(double a, double b, double c)
{
    if(a < b)
        if(a < c)
            return a;
        else
            return c;
    else
        if(b < c)
            return b;
        else
            return c;
}

inline int Math::max(int a, int b)
{
    if(a > b)
        return a;
    else
        return b;
}

inline int Math::max(int a, int b, int c)
{
    if(a > b)
        if(a > c)
            return a;
        else
            return c;
    else
        if(b > c)
            return b;
        else
            return c;
}

inline double Math::max(double a, double b)
{
    if(a > b)
        return a;
    else
        return b;
}

inline double Math::max(double a, double b, double c)
{
    if(a > b)
        if(a > c)
            return a;
        else
            return c;
    else
        if(b > c)
            return b;
        else
            return c;
}

inline int Math::round(double a)
{
    if(a<0)
        return (int) (a-0.5);
    else
        return (int) (a+0.5);
}

inline int Math::floor(double a)
{
    return (int)::floor(a);
}

inline int Math::ceil(double a)
{
    return (int)::ceil(a);
}

inline double Math::pow(double base, double exp)
{
    return ::pow(base, exp);
}

inline double Math::sqrt(double a)
{
    return ::sqrt(a);
}

inline double Math::fabs(double a)
{
    return ::fabs(a);
}

inline double Math::log(double a)
{
    return ::log(a);
}

inline double Math::sin(double a)
{
    return ::sin(a);
}

inline double Math::cos(double a)
{
    return ::cos(a);
}

inline double Math::atan(double a)
{
    return ::atan(a);
}


#endif //_QUICKLIB_MATH_H_
